import _ from 'lodash';
import Login from '../components/Login/index';
import Insurance from '../components/Insurance/index';
import Home from '../components/Home/index';
import HomeSon1 from '../components/Home/HomeSon1';
import HomeSon2 from '../components/Home/HomeSon2';

const routers = [
    {
        path: '/login',//如果有二级路由不要加精准匹配否则会导致二级路由出bug
        component: Login,
        key: _.uniqueId('routerKey'),
    },
    {
        path: '/home',
        component: Home,
        children: [{
            path: '/home/homeSon1',
            component: HomeSon1,
            key: _.uniqueId('homeSon'),
        }, {
            path: '/home/homeSon2',
            component: HomeSon2,
            key: _.uniqueId('homeSon'),
        }, {
            path: '/home',
            redirect: true,
            to: "/home/homeSon1",
            exact: true,
            key: _.uniqueId('homeSon'),
        }],
        key: _.uniqueId('routerKey'),
    },
    {
        path: '/insurance',
        component: Insurance,
        key: _.uniqueId('routerKey'),
    },
    {
        path: '/',
        redirect: true,
        to: "/login",
        exact: true,
        key: _.uniqueId('routerKey'),
    },
];

export default routers;